package com.leyou.common.advice;

import com.leyou.common.exception.LyException;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;

@ControllerAdvice
@Slf4j
public class ControllerExceptionAdvice {
    @ExceptionHandler(LyException.class)
    public ResponseEntity<String> handleLyException(LyException r){
        return ResponseEntity.status(r.getStatus()).body(r.getMessage());
    }
}
